<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/jquery-1.12.4.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .tab {
            height: 100px;
            width: 400px;
            /* background-color: rgb(231, 24, 24); */
        }

        ul {
            width: 400px;
            height: 50px;
            background-color: rgb(0, 0, 0);
        }

        li {
            float: left;
            list-style: none;
            width: 98px;
            height: 50px;
            line-height: 50px;
            text-align: center;
            background-color: rgb(0, 0, 0);
            color: rgb(255, 255, 255);
            border: 1px solid #000;
            font-size: 16px;
        }

        .cs {
            color: #ce2845;
            border-bottom: 2px solid #ce2845;
            background-color: #000;
        }

        .imgs>div {

            float: left;
            width: 400px;
            height: 50px;
            margin: auto;
            background-color: rgb(0, 0, 0);
            color: #fff;
            display: none;
        }

        .one {
            display: block;
        }
    </style>


</head>

<body>
    <div class="tab">
        <ul>
            <li class="cs">前端</li>
            <li>JAva</li>
            <li>Python</li>
            <li>设计</li>
        </ul>
        <div class="imgs">
            <div class="one">前端</div>
            <div>JAva</div>
            <div>Python</div>
            <div>设计</div>
        </div>
    </div>
    <script>
        $(function () {
            let $divs = $('.imgs>div')
            $('li').mouseenter(function () {
                // console.log(221);
                $(this).addClass('cs').siblings().removeClass('cs')
                let index = $(this).index()
                $divs.eq(index).show().siblings().hide()
            })
        })
    </script>
</body>

</html>